#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn=100005;
ll n,b[maxn],q=1,ans,a[10000];
int qread(){
     int x=0,f=1,c=getchar();
     for(;!isdigit(c);c=getchar())if(c=='-')f=-1;
     for(;isdigit(c);c=getchar()) x=(x<<3)+(x<<1)+(c^48);
     return x*f;
}


int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    n=qread();
    ll k=n;
    for(int i=1;i<=n;i++){
        b[i]=qread();
    }
    a[1]=1;
    sort(b+1,b+n+1);
    while(k>=0){
        if(b[k]==b[k-1]){
            a[q]+=1;
            k--;
        }else{
            q++;
            a[q]+=1;
            k--;
        }
    }
    q-=1;
    for(int i=q;i>1;i--){
        if(a[i]<=a[i-1]){
            ans+=a[i];
            a[i]=0;
            for(int j=i;j<=q;j++){
                if(a[j]>0){
                    if(a[i-1]>=a[j]){
                        ans+=a[j];
                        a[j]=0;
                    }else{
                        ans+=a[i-1];
                        a[j]-=a[i-1];
                    }
                }
            }
        }else{
            ans+=a[i-1];
            a[i]-=a[i-1];
        }
    }
    ans=n-ans;
    printf("%lld",ans);
    return 0;
}
